/*
 * NeuronTarget.java
 *
 * Created on Dec 20, 2011
 *
 * Copyright (c) 2011 Artur Rataj.
 *
 * This code is distributed under the terms of the GNU Library
 * General Public License, either version 3 of the license or, at
 * your option, any later version.
 */

package pl.gliwice.iitis.spatialnn.network;

import pl.gliwice.iitis.graphutils.Point;

/**
 * A target being a neuron.
 * 
 * @author Artur Rataj
 */
public class NeuronTarget extends AbstractTarget {
    /**
     * Key of the target neuron.
     */
    public int key;
    
    /**
     * Creates a new instance of <code>NeuronTarget</code>.
     * 
     * @param key key of the target neuron
     */
    public NeuronTarget(int key) {
        super();
        this.key = key;
    }
    @Override
    public Point getLoc(Network network) {
        return network.neuronMap.get(key).loc;
    }
    @Override
    public boolean componentsEqual(AbstractTarget other) {
        if(other instanceof NeuronTarget) {
            NeuronTarget n = (NeuronTarget)other;
            return key == n.key;
        } else
            return false;
    }
    @Override
    public String toStringExact() {
        return key + "/" + index;
    }
    @Override
    public String toString() {
        return toStringExact();
    }
}
